package edu.pku.sei.act.ctrl.command;

import org.eclipse.gef.commands.Command;

import edu.pku.sei.act.model.mote.Mote;
import edu.pku.sei.act.model.mote.OuterModelElement;
import edu.pku.sei.gmp.model.concept.GMPModelElement;

public class CreateBaseCommand extends Command{
	
	private Mote model;
	private GMPModelElement element;
	
	public CreateBaseCommand(GMPModelElement parent, GMPModelElement element ) {
		
		this.model = (Mote)parent;
		this.element = element;
	}
	
	public boolean canExecute() {
		return model !=null && element != null ;
	}
	
	public void execute() {
		if (model != null) {
			element.setContainer(model);
			//model.getRootElements().add(element);
		}
	}
	
	public void undo() {
		if (model != null) {
			//model.getRootElements().remove(element);
		}
		element.setContainer(null);
	}
	
	public void redo(){
		this.execute();
	}

}
